package com.ruoyi.web.utils.v2;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Objects;

@Data
public class V2FactorInfo {

    @ApiModelProperty(value = "产品id")
    private Long productId;

    @ApiModelProperty(value = "产品名称")
    private String productName;

    @ApiModelProperty(value = "物模型属性key")
    private String metadataKey;

    @ApiModelProperty(value = "因子key")
    private String factorKey;

    @ApiModelProperty(value = "因子key")
    private String factorName;

    @ApiModelProperty(value = "因子key")
    private String factorId;

    public void setFactorKey(String factorKey) {
        if(Objects.equals("null",factorKey)){
            this.factorKey = null;
        }else {
            this.factorKey = factorKey;
        }
    }

    @Override
    public boolean equals(Object o) {
        if (this == o){
            return true;
        }

        if (o == null || getClass() != o.getClass()){
            return false;
        }

        V2FactorInfo that = (V2FactorInfo) o;
        return Objects.equals(productId, that.productId) && Objects.equals(factorKey, that.factorKey);
    }

    @Override
    public int hashCode() {
        return Objects.hash(productId, factorKey);
    }
}
